﻿namespace Community.CsharpSqlite.Entity
{
    /*
    ** Each cache entry is represented by an instance of the following
    ** structure. A buffer of PgHdr1.pCache.szPage bytes is allocated
    ** directly before this structure in memory (see the PGHDR1_TO_PAGE()
    ** macro below).
    */

    public class PgHdr1
    {
        public uint iKey; /* Key value (page number) */
        public PCache1 pCache; /* Cache that currently owns this page */
        public PgHdr1 pLruNext; /* Next in LRU list of unpinned pages */
        public PgHdr1 pLruPrev; /* Previous in LRU list of unpinned pages */
        public PgHdr1 pNext; /* Next in hash table chain */
        public PgHdr pPgHdr = new PgHdr(); /* Pointer to Actual Page Header */

        public void Clear()
        {
            iKey = 0;
            pNext = null;
            pCache = null;
            pPgHdr.Clear();
        }
    };
}